//取消订单
		//返回上一页
		$("#go_back").click(function() {
				window.location.href = document.referrer;
			})
			//获取订单类型
		var sdType = sessionStorage.getItem("OrderType");
		var flag = 0;
		if (sdType == "1" || sdType == "2" || sdType == "3") {
			flag = 0;
		} else if (sdType == "5") {
			flag = 2;
		}
		//获取取消订单列表
		var reasonId=null;
		var reason="";
		$.ajax({
			type: "get",
			url: currentUrl + "/interfaceDOC/firstProject/User.ashx?action=Get_OrderReasonList",
			data: {
				"Flag": flag
			},
			dataType: "json",
			success: function(data) {
				console.log(data)
				if (data.msgcode == "1") {
					//生成列表
					$(".weui-cells_radio").html("");     
					for (var i = 0; i < data.data.length; i++) {
					  var cancelStr="";
					  cancelStr+= "<label class='weui-cell weui-check__label' for='reason"+i+"''>";
					  cancelStr+= "<div class='weui-cell__bd'><p class='reason'>"+data.data[i].Reason+"</p></div>";
					  cancelStr+= "<div class='weui-cell__hd'>";
					  cancelStr+= "<input type='radio' class='weui-check' name='radio1' id='reason"+i+"'>";
					  cancelStr+="<span class='weui-icon-checked'></span></div></label>";
					  $(".weui-cells_radio").append(cancelStr);
					  $(".weui-cells_radio .weui-check").eq(i).data("reasonId",data.data[i].Id);
					  $(".weui-cells_radio .weui-check").eq(i).data("reason",data.data[i].Reason);
					}	
				}
				$(".weui-check").eq(0).prop("checked","checked");
				reasonId=$(".weui-check").eq(0).data("reasonId");
				reason=$(".weui-check").eq(0).data("reason");
				radioClick();
			},
			error: function() {
				$.alert("无法获得取消订单列表");
			}
		});
		// 设置单选点击函数
		function radioClick(){
			$(".weui-check").click(function(){
				reasonId=$(this).data("reasonId");
				reason=$(this).data("reason");
				// console.log(reasonId)
			})
		}
		radioClick()
		var OrderId = sessionStorage.getItem("OrderId");
		var userInfo = localStorage.getItem("userInfo");
		var userInfoObj = JSON.parse(userInfo);
		//取消订单
		$('.form_submit').click(function() {
			if (reasonId == null) {
				$.alert('请选择原因')
				return false
			} else {
				$.confirm("要取消订单吗？", function() {
				  // 点击确认后的回调函数
					  $.ajax({
						type: "post",
						url: currentUrl+"/api/order/cancel",
						data: {
							"id":OrderId,
							"UserId":userInfoObj.data.UserId,
							"UserTel":userInfoObj.data.Phone,
							"reason": reason
						},
						dataType: "json",
						success: function(data) {
							// console.log(data);
							if (data.isOk == true) {
								// console.log(data.msg);
								sessionStorage.clear();
								window.location.href = "../index.html";
							} else if (data.isOk == false){
								alert(data.msg)//日后优化
								window.location.href = document.referrer; //返回上一页
							}
						},
						error: function() {
							$.alert("请求错误");
						}
					})
				 }, function() {
				  //点击取消后的回调函数
				  // console.log("取消操作")
				 });
				
			}
		})